import { defHttp } from '/@/utils/http/axios';
import {
  DictListGetResultPageModel,
  DictListGetResultModel,
  DictParams,
} from '/@/api/sys/model/dictModel';

enum Api {
  DictRestFul = '/sys/dict',
  GetDictAll = '/sys/dict/list',
  GetDictPage = '/sys/dict/page',
}

export const getDictListByPage = (params?: DictParams) =>
  defHttp.get<DictListGetResultPageModel>({ url: Api.GetDictPage, params });

export const getAllDictList = (params?: DictParams) =>
  defHttp.get<DictListGetResultModel>({ url: Api.GetDictAll, params });

export const deleteDict = (id: number) => defHttp.delete<void>({ url: Api.DictRestFul + `/${id}` });

export const updateDict = (params: DictParams) =>
  defHttp.put<void>({ url: Api.DictRestFul, params });

export const updateDictStatus = (params: DictParams) =>
  defHttp.put<void>({ url: Api.DictRestFul, params });

export const createDict = (params: DictParams) =>
  defHttp.post<void>({ url: Api.DictRestFul, params });
